home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-17 | 5.3 KB | 265 lines | [TEXT/sLiN] |
- ! Version 2.1
- !
- !$ Use with: Prometheus Home Office modems.
- !
- !$ Supports: MaxFax voice/fax and AppleTalk Remote Access.
- !
- !$ In MaxFax, set "Rings till answer" to 1, "Toll Saver" to 0.
- !
- !$To access the ARA server, extend the phone number with
- !$ 8 commas and 1-3 "Data Link Codes" separated with commas.
- !
- !$ Sample: "555-234,,,,,,,,5,5,5".
-
- ^2 Speaker On: = Enum("Never" = "0","During Connect" = "1", "Always"="2") "1"
- ^3 Speaker Volume: = Enum("Low"="1","Medium"="2","High"="3") "2"
- ^4 Answer On: = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
- ^5 Fax Identifier: = Text "Stalker"
- ^6 Handshake wires: = Bool("CTS/RTS"="&D0\Q3","CTS only"="&D2\Q2") "&D2\Q2"
- ^7 Data Line Code: = Enum("1"="","2"="","3"="","4"="","5"="","6"="","7"="","8"="","9"="") ""
- ! ------------------------------------------
- ! Resetting the modem:
- ! ------------------------------------------
- @Hangup
- Note "Resetting" 3
- SetTries 2
- Flush
- HsReset 0,0,17,19,0,0
- !
- ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
- ! to enter the command mode
- !
- @Label 1
- matchclr
- matchstr 1 2 "OK\r\n"
- write "ATH0&F\r"
- matchread 20
- Write "+++"
- DtrClear
- pause 5
- DtrSet
- !
- SerReset 19200,0,8,1
- DecTries
- IfTries 1 1
- SerReset 9600,0,8,1
- IfTries 0 1
- !
- ! OSErr -6019 "Modem error - the modem is not responding"
- !
- exit -6019
- @Label 2
- SerReset 9600,0,8,1
- write "AT+FCLASS=0\r"
- Jsr 100
- write "AT+FAA=0\r"
- Jsr 100
- exit 0
-
- ! ------------------------------------------
- ! Receiving incoming calls
- ! ------------------------------------------
- @ANSWER
- !
- ! Set the modem preferred speed first
- !
- SerReset 9600,0,8,1
- Jsr 80
- @Label 10
- !
- ! Set the common options
- Jsr 70
-
- Write "AT+FAA=1\r"
- Jsr 100
- !
- ! Everything is ready - let's sit and wait for a call
- ! We'll wait for 5 minutes, then reinitiate the modem
- !
- Note "Waiting for a fax/voice or ARA call…"
- SetTries Val("^4")
- @Label 15
- MatchClr
- matchstr 1 16 "RING\r\n"
- Matchread 3000
- jump 10
- @Label 16
- Note "Ring…"
- DecTries
- IfTries 1 15
-
- ! A = <dle> 0x11 <digit code>
- ! B = 0x1F (* code)
- !
- SetVar A "\16\17^7"
- SetVar B "\31\r\nOK\r\n"
- QueueInput "\r\nRING\r\n\r\nRING\r\n"
- Attach "MaxFax" (DTR,Escape,Master,Check(A,B))
- Pause 5
- !
- !now abort greetings, if any in progress
- Write "\16\03"
- MatchClr
- MatchStr 1 17 "OK\r\n"
- MatchRead 40
- @Label 17
- !
- ! switch off voice modes
- Write "AT#VS0\r"
- Jsr 100
- SerReset 9600,0,8,1
-
- Write "AT#VH0\r"
- Jsr 100
-
- Write "AT+FAA=0\r"
- Jsr 100
- !
- ! Set the common options
- Jsr 70
- !
- ! Set ARA parameters, force to answer in the data mode
- Write "AT\\N0W1A\r"
- MatchClr
- MatchStr 1 20 "\r\nCARRIER "
- MatchStr 4 93 "NO CARRIER\r\n"
- MatchStr 5 94 "NO ANSWER\r\n"
- MatchRead 300
- Write "\r"
- Exit -6019
-
- @Label 20
- QueueInput "\r\nCARRIER "
- ifOriginate 21
- QueueInput "\r\nRING\r\n"
- @Label 21
- Attach "ARA" (DTR,Escape,TimeLimit=0)
-
- ! ------------------------------------------
- ! Originating a call through the "ARA" subport
- ! ------------------------------------------
- @ORIGINATE "ARA"
- SerReset 9600,0,8,1
- Jsr 80
- !
- ! Set the common options
- !
- Jsr 70
- !
- ! Set the Data mode:
- ! • \N0 Normal connection (no compression, correction - for ARA)
- ! • W1: report connection rate
- !
- Write "AT\\N0W1\r"
- Jsr 100
- !
- ! Prepare to receive all error result codes, dial the number
- !
- Jsr 90
- MatchStr 1 20 "\r\nCARRIER "
- MatchRead 1000
- Write "\r"
- Exit -6019
-
- ! ------------------------------------------
- ! Originating a call through the "MaxFax" subPort
- ! ------------------------------------------
- @ORIGINATE "MaxFax" ("\r\nLineShare Line is Busy\r\nBUSY\r\n")
- !
- ! Set the "Fax" speed
- !
- SerReset 9600,0,8,1
- Jsr 80
- !
- ! Set the common options
- !
- Jsr 70
- !
- ! Set the Fax mode
- !
- Write "AT+FCLASS=2\r"
- Jsr 100
- SetSpeed 19200
- !
- ! Now emit all commands that the application has sent to that port, except +FCLASS
- !
- EmitClear "+FCLASS"
- Jsr 60
- !
- ! Prepare to receive all error result codes, dial the number
- !
- Jsr 90
- HSReset 0 1 0 0 0 0
- MatchStr 1 30 "\r\n+FCON"
- MatchRead 900
- Write "\r"
- Exit -6019
- !
- ! This section emits all modem commands sent from the client application
- ! For each set of commands the "OK" answer is awaited
- !
- @Label 60
- EmitStart
- @Label 61
- EmitCommand 62
- Jsr 100
- Jump 61
- @Label 62
- return
- !
- ! This section initiates the modem before ANSWER and ORIGINATEs:
- ! extended responses + connect at the highest rate + speaker control +
- ! reset on Dtr drop
- ! Verbal responses mode, no echo
- !
- @Label 70
- Write "ATX4M^2L^3^6V1E0\r"
- Jsr 100
- return
-
- !
- ! This section syncronize the modem after the serial port speed switching
- !
- @Label 80
- ChrDelay 1
- Write "AT\r"
- ChrDelay 0
- Jsr 100
- return
- !
- ! Prepare to receive error result codes, send the dialing command and
- ! set the user's handshake mode
- !
- @Label 90
- MatchClr
- MatchStr 2 91 "NO DIALTONE\r\n"
- MatchStr 3 92 "BUSY\r\n"
- MatchStr 4 93 "NO CARRIER\r\n"
- MatchStr 5 94 "NO ANSWER\r\n"
- Write "ATD^1\r"
- HsReset *
- return
- @Label 91
- exit -6020
- @Label 92
- exit -6022
- @Label 93
- exit -6021
- @Label 94
- exit -6023
- !
- ! Processing the AT command:
- ! OK -> proceed
- ! ERROR or TimeOut ->exit -6019
- ! It can be called AFTER the "Write" command, since LineShare buffers input
- !
- @Label 100
- MatchClr
- MatchStr 1 102 "\r\nOK\r\n"
- MatchStr 2 101 "\r\nERROR\r\n"
- MatchRead 20
- @Label 101
- Exit -6019
- @Label 102
- return
-